//
//  UGAlignmentTextFieldExampleViewController.m
//  Example
//
//  Created by admin on 2020/5/19.
//  Copyright © 2020 admin. All rights reserved.
//

#import "UGAlignmentTextFieldExampleViewController.h"

@interface UGAlignmentTextFieldExampleViewController ()

@property(strong, nonatomic) UGTextField *textTF;

@property(strong, nonatomic) UGTextField *numTF;

@property(strong, nonatomic) UGTextField *floatTF;

@end

@implementation UGAlignmentTextFieldExampleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = UIColor.whiteColor;
    [self.view addSubview:self.textTF];
    [self.view addSubview:self.numTF];
    [self.view addSubview:self.floatTF];
}

-(UGTextField *)textTF{
    if (!_textTF) {
        _textTF = [UGTextField new];
        [_textTF ug_borderColor:COLOR_EE width:0.5];
        _textTF.inputType = InputTypeText;
        _textTF.placeholder = @"InputTypeText 限制表情输入";
    }
    return _textTF;;
}

-(UGTextField *)numTF{
    if (!_numTF) {
        _numTF = [UGTextField new];
        [_numTF ug_borderColor:COLOR_EE width:0.5];
        _numTF.inputType = InputTypeNumber;
        _numTF.placeholder = @"InputTypeNumber 只允许输入数字";
    }
    return _numTF;;
}

-(UGTextField *)floatTF{
    if (!_floatTF) {
        _floatTF = [UGTextField new];
        _floatTF.inputType = InputTypeFloat;
        [_floatTF ug_borderColor:COLOR_EE width:0.5];
        _floatTF.floatCount = 3;
        _floatTF.placeholder = @"InputTypeFloat 只允许输入float，保留3位小数";
    }
    return _floatTF;;
}
-(void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    [_textTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(15);
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(15);
        make.height.mas_equalTo(45);
    }];
    [_numTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.textTF.mas_bottom).mas_offset(15);
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(15);
        make.height.mas_equalTo(45);
    }];
    [_floatTF mas_makeConstraints:^(MASConstraintMaker *make) {
          make.top.mas_equalTo(self.numTF.mas_bottom).mas_offset(15);
          make.left.mas_equalTo(15);
          make.right.mas_equalTo(15);
          make.height.mas_equalTo(45);
      }];
    
}
@end
